package com.sw.c.controller;

import com.alibaba.fastjson.JSON;
import com.sw.c.mapper.mongodb.UserMongo;
import com.sw.c.pojo.entity.UserMongoDB;
import com.sw.c.service.UserService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "测试Mongodb")
@RestController
public class MongodbController {
    @Resource
    private UserService userService;

    @Resource
    private UserMongo userMongo;

    @GetMapping("/getAll")
    public List<UserMongoDB> getAll(){
        List<UserMongoDB> all = userMongo.findAll();
        return all;
    }
    @GetMapping("/getAllUser")
    public List<UserMongoDB> getAllUser(){
        return userService.getAllUser();
    }
//    @PostMapping("/getUserByName")
//    public UserMongoDB getUserByName(@PathVariable String name) { //根据用户名查询用户
//        return userService.getUserByUsername(name);
//    }
//    @PostMapping("/deleteUserById")
//    public void deleteUserById(@PathVariable String id) {
//        //根据用户id查询用户
//        userService.deleteUserById(id);
//    }

}
